package com.jackeysun.app_common

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.jackeysun.app_common.databinding.ActivityMain4Binding
import com.jackeysun.common.ActivityManager.appExit
import com.jackeysun.common.ActivityManager.currentActivity
import com.jackeysun.common.ActivityManager.findActivity
import com.jackeysun.common.ActivityManager.finishActivity
import com.jackeysun.common.ActivityManager.finishActivityExcept
import com.jackeysun.common.ActivityManager.finishActivityExceptCurrent
import com.jackeysun.common.ActivityManager.finishAllActivity
import com.jackeysun.common.ActivityManager.finishCurrentActivity
import com.jackeysun.common.ActivityManager.getActivates
import com.jackeysun.common.ActivityManager.getTopActivity
import com.jackeysun.common.ActivityManager.getTopActivityName

class MainActivity4 : AppCompatActivity() {

    val TAG = MainActivity4::class.java.simpleName
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val main4Binding = ActivityMain4Binding.inflate(layoutInflater)
        setContentView(main4Binding.root)

        main4Binding.currentActivity.setOnClickListener {
            Log.d(TAG, "onCreate: ${currentActivity()}")
        }

        main4Binding.finishCurrentActivity.setOnClickListener {
            Log.d(TAG, "onCreate: ${finishCurrentActivity()}")
        }

        main4Binding.finishActivity1.setOnClickListener {
            Log.d(TAG, "onCreate: ${this@MainActivity4.finishActivity()}")
        }

        main4Binding.finishActivity2.setOnClickListener {
            Log.d(TAG, "onCreate: ${MainActivity4::class.java.finishActivity()}")
        }

        main4Binding.findActivity.setOnClickListener {
            Log.d(TAG, "onCreate: ${MainActivity4::class.java.findActivity()}")
        }

        main4Binding.getTopActivity.setOnClickListener {
            Log.d(TAG, "onCreate: ${getTopActivity()}")
        }

        main4Binding.getTopActivityName.setOnClickListener {
            Log.d(TAG, "onCreate: ${getTopActivityName()}")
        }

        main4Binding.appExit.setOnClickListener {
            Log.d(TAG, "onCreate: ${appExit()}")
        }

        main4Binding.getActivates.setOnClickListener {
            Log.d(TAG, "onCreate: ${getActivates()}")
        }

        main4Binding.finishAllActivity.setOnClickListener {
            Log.d(TAG, "onCreate: ${finishAllActivity()}")
        }

        main4Binding.finishActivityExceptCurrent.setOnClickListener {
            Log.d(TAG, "onCreate: ${finishActivityExceptCurrent()}")
        }

        main4Binding.finishActivityExcept.setOnClickListener {
            Log.d(TAG, "onCreate: ${MainActivity::class.java.finishActivityExcept()}")
        }
    }
}